<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h1>删除页面</h1>
  <input type="text" id="uid">
  <button onclick="del()">删除</button>
  <div id="d1"></div>
  <script>
    function del() {
      var $uid = uid.value;
      // 1.创建异步对象
      var xhr = new XMLHttpRequest();
      // 4.接收响应，创建监听
      xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
          var r = xhr.responseText;
          console.log(r);
          if (r == 1) {
            d1.innerHTML = "删除成功";
          } else {
            d1.innerHTML = '删除失败';
          }
        }
      }
      // 2.创建请求，打开连接
      xhr.open("delete", "/pro/v1/del/" + $uid, true);
      // 3.发送请求
      xhr.send();
    }
  </script>
</body>

</html>